<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

use app\admin\logic\Log as LogicLog;

/**
 * 记录行为日志
 */
function action_log($name = '', $describe = '')
{
    if(session('member_info.username')!='dagu1') {
        $member_info = session('member_info');

        $request = request();

        $data['member_id'] = $member_info['id'];
        $data['username']  = $member_info['username'];
        $data['ip']        = $request->ip();
        $data['url']       = $request->url();
        $data['status']    = DATA_NORMAL;
        $data['name']      = $name;
        $data['create_time']      = time();
        $data['describe']  = $describe;
        \app\admin\model\ActionLog::create($data);
//        return $this->modelActionLog->setInfo($data)
    }
}

/**
 * 清除登录 session
 */
function clear_login_session()
{

    session('member_info',      null);
    session('member_auth',      null);
    session('member_auth_sign', null);
}

function  asc_sort($params = array())
{
    if (!empty($params)) {
        $p = ksort($params);

        if ($p) {
            $str = '';
            foreach ($params as $k => $val) {
                if($val){
                    $str .= $k . '=' . $val . '&';
                }

            }
            $strs = rtrim($str, '&');
            return $strs;
        }
    }
    return false;
}

